<template>
  <view class="picker">
    <view class="pickerHead">
        <text class="title">选择行业</text>
        <text class="icon">关闭</text>
    </view>
    <picker-view class="pickerView" indicator-class="picker-box" indicator-style="height: 40px;" @change="ChangePicker" :value="innerIndex" >
        <picker-view-column class="pickerViewColum">
            <view 
                v-for="(item, index) in innerColumns" 
                class="item"
                :class="{'activeTitle':innerIndex[0] == index}"
                :key="index">{{item.title}}
            </view> 
        </picker-view-column>
    </picker-view>
    <view class="pickerBtn">确认</view>
  </view>
</template>

<script>
export default {
    name: 'picker',
    data() {
        return {
            innerColumns: [
                {
                    title: '计算机应用'
                },
                {
                    title: '医疗服务'
                },
                {
                    title: '光伏ETF'
                },
                {
                    title: '通信服务'
                },
                {
                    title: '有色金属'
                },
                {
                    title: '新能源'
                },
                {
                    title: '煤炭ETF'
                },
                {
                    title: '稀土元素'
                }
            ],
            innerIndex: [4]
        }
    },
    methods: {
        ChangePicker(e) {
            const current = e.detail.value;
            this.innerIndex = current;
        }
    }
}
</script>

<style lang="scss" scoped>
.picker {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 32rpx;
    &Head {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        padding-top: 64rpx;
        width: 100%;
        position: relative;
        .icon {
            position: absolute;
            right: 0;
        }
    }
    &View {
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 304rpx;
        margin-top: 70rpx;
        .item {
            color: #909399;
            z-index: 10;
            font-size: 32rpx;
            line-height: 40px;
            text-align: center;
        }
        .activeTitle {
            color: #303133;
        }
    }
    /deep/ .picker-box {
        margin: 0 auto;
        width: 686rpx;
        height: 80rpx;
        background: #F4F5F6;
        border-radius: 8rpx;
        z-index: -1;
    }
    &Btn {
        width: 280rpx;
        height: 88rpx;
        line-height: 88rpx;
        text-align: center;
        background: #1988F4;
        border-radius: 44rpx;
        margin: 56rpx 0 23rpx 0;
        color: white;
        font-size: 32rpx;
    }
}
</style>